package ap.project;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Twistymain extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);     

        final EditText editipadres = (EditText) findViewById(R.id.edtip);
        final EditText edtport = (EditText) findViewById(R.id.edtport);
        Button send = (Button) findViewById(R.id.sendbutton);

            send.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                	
            		String ip = editipadres.getText().toString();
            		Intent joystick = new Intent(getBaseContext(),
            				Joystick.class);
            		int port = 0;
            		if(!edtport.getText().toString().equals("")) {
            			port = Integer.parseInt(edtport.getText().toString());
            		}
            		joystick.putExtra("ip", ip);
            		joystick.putExtra("port", port);
            		startActivity(joystick);
                }
            });
    }
}
